package Test2;

public class Fail {

    public static void main(String[] args) {


        int[] nums={4,7,10,2,9,44,33,21,88,67,93,22,15,60};

        quicksort(nums,0,nums.length-1);

        for (int num : nums) {
            System.out.print(num+" ");
        }
    }

    private static void quicksort(int[] nums, int begin, int end) {

        if(begin>=end){
            return;
        }
        int left=begin;
        int right=end;

        int x=nums[begin];
        while(left<right){

            while(left<right&&nums[right]>=x){
                right--;
            }

            while(left<right&&nums[left]<=x){
                left++;
            }

            int temp=nums[left];
            nums[left]=nums[right];
            nums[right]=temp;


        }

        nums[begin]=nums[left];
        nums[left]=x;

        quicksort(nums,begin,left-1);
        quicksort(nums,right+1,end);
    }
}
